package lambdasinaction.chap10.my;

import java.util.Optional;

/**
 * 车
 *
 * @author Fish
 * @since 0.0.1 2018/8/10 19:52
 */
public class MyCar {

  private MyInsurance insurance;

  /**
   * 车可能进行了保险，也可能没有保险
   * 所以将这个字段声明为 Optional
   */
  private Optional<MyInsurance> optionalInsurance;

  public Optional<MyInsurance> getOptionalInsurance() {
    return optionalInsurance;
  }

  public void setOptionalInsurance(
      Optional<MyInsurance> optionalInsurance) {
    this.optionalInsurance = optionalInsurance;
  }

  public MyInsurance getInsurance() {
    return insurance;
  }

  public void setInsurance(MyInsurance insurance) {
    this.insurance = insurance;
  }
}
